<!DOCTYPE html>
<html lang="en">
<head>
    <title>佳怡供应链金融</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
    <link rel="stylesheet" href="lib/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.css">
    <link rel="stylesheet" href="demos/css/demos.css">
    <link rel="stylesheet" href="font/fontscss/iconfont.css">
    <link rel="stylesheet" href="css/common.css">
    <style type="text/css">
        .content-header {
            width: 100%;
            background-color: #FF9461;
            position: relative;
            z-index: 10;
            color: #fff;
        }

        #pro_name {
            font-size: 16px;
            padding-top: 0.7rem;
            padding-left: 15%;
        }

        #one_pri {
            font-size: 32px;
        }

        .ljsy {
            pont-size: 12px;
            opacity: 0.6;
        }

        .tzze {
            padding-top: 1.5rem;
            font-size: 16px;
        }

        .time {
            text-align: center;
        }

        .time-left {
            width: 50%;
            display: inline-block;
            line-height: 1.5rem;
        }

        .span1 {
            font-size: 14px;
        }

        .span2 {
            font-size: 12px;
            opacity: 0.6;
        }

        .time-left span {
            display: block;
        }

        .time-right {
            width: 48%;
            float: left;
            line-height: 1.5rem;
        }

        .time-right span {
            display: block;
        }

        .content-info ul li {
            height: 3rem;
            line-height: 3rem;
            border-bottom: 1px solid #E6E2E2;
            font-size: 16px;
        }

        .content-info ul li span {
            color: #FF9461
        }

        .content-info .content-orl {
            width: 10%;
            display: inline-block;
        }

        .content-info .content-title {
            width: 59%;
            display: inline-block;
        }

        .content-info .content-info {
            width: 18%;
            display: inline-block;
        }

        .content-info .content-orl {
            background-image: url("demos/images/rol.png");
        }
        .comment{
            border: 1px solid #ABA1A1;
            border-radius: 1rem;
            width: 64%;
            position: relative;
            left: 5rem;
            margin-top: 1rem;
        }
        .tbtop{
            padding-left: 1rem;
            color:#FF9461;
        }
        .tbtop span{
            display: block;
        }
        .pz{
            margin-left: 1rem;
        }
        .weui-btn-area{
            margin-top: 3rem;
        }
        .icon_back{
            position: absolute;
            left: -1rem;
            top: 0.9rem;
            width: 0.5rem;
            height: 1.0rem;
            background: url(./images/icon-back.png);
            background-size: 0.5rem 1em;
            vertical-align: middle;
        }
    </style>
    <script src="lib/jquery-2.1.4.js"></script>
    <script type='text/javascript' src='js/swiper.js' charset='utf-8'></script>

</head>

<body>
<header>
    <div class="weui-row weui-no-gutter">
        <div class="weui-col-33" id="back_icon">
            <a href="javascript:history.go(-1)" class="icon pull-right"><i class="icon_back"></i></a>
        </div>
        <div class="weui-col-33">申请详细</div>
        <div class="weui-col-33" id="ligin_icon">
            <!-- <a href="login.html" class="icon pull-right"><i class="iconfont icon-wode"></i></a> -->
        </div>
    </div>
</header>
<div class="weui-cells">
    <input type="hidden" id="names">
    <input type="hidden" id="pocessId">
    <input type="hidden" id="apply_money">
    <input type="hidden" id="btnName">
    <input type="hidden" id="type">
    <div  class="weui-cell" id="img"></div>
    <div class="weui-cell" id="flagcell">
        <div class="weui-cell__hd"><label class="weui-label">选择上级审核人</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" id="dbUser" name="dbUser" >
        </div>
    </div>

    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">批注</label></div>

        <div class="weui-cell__bd">
            <textarea class="weui-textarea" placeholder="请输入备注" rows="3" id="beizhu"></textarea>
            <div class="weui-textarea-counter"><span>0</span>/200</div>
        </div>
    </div>
</div>
<div class="weui-btn-area">
    <a class="weui-btn weui-btn_primary" id="conf" onclick="complte(1)">通过</a>
    <a class="weui-btn weui-btn_primary" id="bohui" onclick="complte(2)">驳回</a>
</div>
</body>
<script src="js/circleProgress.js"></script>
<script src="js/jquery-weui.js"></script>
<script src="js/select2.js"></script>
<script src="js/select2_locale_zh-CN.js"></script>
<link rel="stylesheet" href="js/select2.css">

<script src="js/reg.js"></script>
<script type="text/javascript">
    var id = localStorage.getItem("daisp_id");
    var name=localStorage.getItem("data-name");
    $(function () {


        var str = "";
        var imgs="";
        // var name="";
        var tm="";
        if(name=="供应链金融经理审核"){
            tm="事业部资金经理审核";
        }
        if(name=="事业部财务总监审核"){
            tm="事业部总经理审核";
        }else if(name=="事业部总经理审核"){
            tm="供应链金融产品经理审核";
        }else if(name=="供应链金融产品经理审核"){
            tm="供应链总经理审核";
        }else if(name=="供应链总经理审核"){
            tm="总裁审核";
        }
        tm="请选择"+tm;

        $("#dbUser").select2({
            placeholder: tm,	//默认文本框显示信息

            minimumInputLength: 1,	//最小输入字符长度
            multiple: false,				//设置多项选择，false则只能单选
            allowClear: true,
            maximumSelectionSize: 5,
            query: function (query) {
                $.ajax({
                    type: "POST",
                    url: "rzRelease/getUsers",
                    data: {name: query.term},   //传递输入框中的值
                    success: function (msg) {
                        var msg = $.parseJSON(msg);
                        var data = {results: []};
                        $.each(msg, function (x, y) {
                            data.results.push({id: y.id, text: y.name});
                        });
                        query.callback(data);
                    }
                });
            }
        });

        $.ajax({
            type: "POST",
            url: "ccc/getsingTaskCredit",
            data: {id: id},   //传递输入框中的值
            success: function (val) {
                var msg=val.mm;
                console.info(msg);
               // var apply_money=msg.apply_money;
                name=msg.name
                $("#names").val(name);
                $("#pocessId").val(msg.processId);
                $("#apply_money").val(apply_money);
                $("#type").val(msg.types);
                str+="<div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>项目名称</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.project_namegd2+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>合同编号</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.bh+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>审批状态</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">" +
                    "未审核"+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>申请日期</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.apply_time+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>资金使用起始时间</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.start_time+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>资金使用结束时间</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.end_time+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>使用部门</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.deptname+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>使用中心</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    isNull(msg.centername)+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>使用项目部</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    isNull(msg.projectDeptname)+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>申请人</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.username+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>申请金额</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.apply_money+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>综合融资成本率</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.rate*100+"%"+
                    "        </div>"+
                    "    </div>"+

                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>综合融资成本</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.finance_cost+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>融资用途</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.purpose+
                    "        </div>"+
                    "    </div>"+
                  /*  "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>还款时间</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.yjrepayment_time1+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>还款金额</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.yjrepayment_money1+
                    "        </div>"+
                    "    </div>"+*/
                        /*     "    <div class=\"weui-cell\">"+
                         "        <div class=\"weui-cell__bd\">"+
                         "            <p>预计还款时间2</p>"+
                         "        </div>"+
                         "        <div class=\"weui-cell__ft\">"+
                         msg.yjrepayment_time2+
                         "        </div>"+
                         "    </div>"+
                         "    <div class=\"weui-cell\">"+
                         "        <div class=\"weui-cell__bd\">"+
                         "            <p>预计还款金额2</p>"+
                         "        </div>"+
                         "        <div class=\"weui-cell__ft\">"+
                         msg.yjrepayment_money2+
                         "        </div>"+
                         "    </div>"+*/
                  /*  "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>乙方开户行</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.yopen_bank+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>乙方账户名</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.yaccount_name+
                    "        </div>"+
                    "    </div>"+
                    "    <div class=\"weui-cell\">"+
                    "        <div class=\"weui-cell__bd\">"+
                    "            <p>乙方账号</p>"+
                    "        </div>"+
                    "        <div class=\"weui-cell__ft\">"+
                    msg.yaccount_number+
                    "        </div>"+
                    "    </div>"+
                        /!* "<div id=\"jiafang\" style=\"display: none\">"+*!/
                    "<div  class=\"weui-cell jiafang\" style=\"display:none\">"+
                    "<div class=\"weui-cell__hd\"><label class=\"weui-label\">甲方开户行</label></div>"+
                    "<div class=\"weui-cell__bd\">"+
                    "<input class=\"weui-input\" type=\"text\" name=\"jopen_bank\" placeholder=\"请输入资金账户\" id=\"jopen_bank\"/>"+
                    "  </div>"+
                    " </div>"+
                    "    <div class=\"weui-cell jiafang\" style=\"display:none\">"+
                    "   <div class=\"weui-cell__hd\"><label class=\"weui-label\">甲方账户名</label></div>"+
                    "   <div class=\"weui-cell__bd\">"+
                    "    <input class=\"weui-input\" type=\"text\" name=\"jaccount_name\" placeholder=\"请输入资金账户\" id=\"jaccount_name\"/>"+
                    "    </div>"+
                    "   </div>"+
                    "   <div class=\"weui-cell jiafang\" style=\"display:none\">"+
                    "   <div class=\"weui-cell__hd\"><label class=\"weui-label\">甲方账号</label></div>"+
                    "    <div class=\"weui-cell__bd\">"+
                    "   <input class=\"weui-input\" type=\"text\" name=\"jaccount_number\" placeholder=\"请输入资金账户\" id=\"jaccount_number\"/>"+
                    "   </div>"+*/
                        /* "   </div>"+*/
                    "</div>";
                $(".weui-cells").prepend(str);

                var imgs="";
                var imgs2 = new Array()
                // imgs+="<div>"
                imgs+="<div class=\"pz\">图片:"
                imgs+= "<div class=\"tbtop\">"


                $.each(val.mfList,function (x,y) {
                    imgs+="  <img style='width: 30%;height:30%;float: 'id='"+x+"' class='img' src='rzRelease/getimgurlcp?iurl="+y.filename+"'>"
                    imgs2[x]='rzRelease/getimgurlcp?iurl='+y.filename+''

                    // imgs+="    <div class=\"tbtop\" style='margin:auto; overflow:visible;text-align:center;'>"
                    // imgs+=" <img style='width: 30%;height:30%;float: ' src='rzRelease/getimgurlcp?iurl="+y.filename+"'></img> "
                    //imgs+="</div>"
                })

                console.info(imgs2)
                imgs+="</div>";
                imgs+="</div>";
                $("#img").append(imgs);
                var pb1 = $.photoBrowser({
                    items: imgs2
                });

                $(".img").on("click",function(){
                    pb1.open(this.id)
                })
                /* var commons="";
                 commons+="<div>"
                 commons+="<div class=\"pz\">批注：</div>"
                 $.each(val.list,function (x,y) {
                 commons+="<div class=\"comment\">"
                 commons+="    <div class=\"tbtop\">"
                 commons+="   <span>批注人："+y.realname+"</span>"
                 commons+="<span>批注部门："+y.department_name+"</span>"
                 commons+=" <span>批注:"+y.message_+"</span>"
                 commons+="<span>批注时间："+y.time_+"</span>"
                 commons+="</div>"
                 commons+=" </div>"
                 })
                 commons+="</div>";
                 $(".weui-cells").append(commons);*/
               /* if(name=="供应链金融产品经理审核"){
                    $(".jiafang").removeAttr("style");
                }*/
               /* if((apply_money<=2000000 && name == "供应链总经理审核")||(apply_money>2000000 && name == "总裁审核")){
                    $("#flagcell").css("display","none");
                }*/
                if(name == "供应链总经理审核"){
                    $("#flagcell").css("display","none");
                }

                //  $("#dbUser").attr('placeholder',name);



            }
        });






    });
    function complte(flag) {
        if (flag == 1) {
            $("#btnName").val("通过");
            if( $(".weui-textarea").val()==null || $("#beizhu").val()=='') {
                $(".weui-textarea").val("同意");
            }
        } else {
            $("#btnName").val("驳回");
        }
        var name=$("#names").val();
        var dbname=null;
        if($("#dbUser").val()!=null && $("#dbUser").val()!=''){
            dbname=$.trim($("#dbUser").select2("data").text);
        }
        if (($("#dbUser").val() == null || $("#dbUser").val() == "")
            && (name != "供应链总经理审核") && flag!=2) {
            alert('请完整信息');
        } else {
            $.ajax({
                type : "POST",
                url : 'ccc/applySh',
               // url : "rzRelease/applySh?name="+name+"&dbname="+dbname+"",
                data : {
                    "commons":$(".weui-textarea").val(),
                    "jopen_bank":$("#jopen_bank").val(),
                    "jaccount_name":$("#jaccount_name").val(),
                    "jaccount_number":$("#jaccount_number").val(),
                    "id":id,
                    "pocessId":$("#pocessId").val(),
                    "dbUser":$("#dbUser").val(),
                    "apply_money":$("#apply_money").val(),
                    "btnName":$("#btnName").val(),
                    "type":$("#type").val(),
                    "token":localStorage.getItem("token")
                },
                success : function(msg) {
                    $.toast("审核成功");
                    window.location.href = "daisp.html"
                }
            });
        }
    }
    function isNull(str) {
        if (str == null || str == "" || str == "undefined") {
            return '';
        } else {
            return str;
        }
    }
</script>
<script src="js/web/checkLogin.js"></script>
</html>